package org.chen.client;

import org.chen.common.domain.R;
import org.chen.domain.dto.CategoryDTO;
import org.chen.domain.vo.CategoryVO;
import org.chen.client.fallback.CategoryFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "video-category", fallback = CategoryFeignFallback.class)
public interface CategoryFeignClient {

    @GetMapping("/api/category/tree")
    R<List<CategoryVO>> getCategoryTree(@RequestParam("type") String type);

    @GetMapping("/api/category/{id}")
    R<CategoryVO> getCategory(@PathVariable("id") String id);

    @GetMapping("/api/category/batch")
    R<List<CategoryVO>> getCategoriesByIds(@RequestParam("ids") List<String> ids);

    @PostMapping("/api/category")
    R<Void> addCategory(@RequestBody CategoryDTO dto);

    @GetMapping("/api/category/{id}/children")
    R<List<CategoryVO>> getChildren(@PathVariable("id") String id);
}